#include "sysregs.h"
#include "irq.h"
#include "timer.h"
#include "asm/base.h"

extern void vm_main(unsigned long gpa_addr);

static void test1(){
    int i = 1;
    return;
}

void virt_main(){

    unsigned long current_el = 0;

    unsigned long gpa_addr, gva_addr; 

    gpa_addr = get_free_page();
    *(unsigned long *)gpa_addr = 0x12345678;

    printk("gpa_addr is gpa_addr");

    current_el = (read_sysreg(CurrentEL) >> 2) & 0x3;

    printk("before : Current exception level is EL%lu\n", current_el);
	
	write_stage2_pg_reg();

	gpa_addr = jump_to_vm(gpa_addr);

	//hvc_call(10);

   	current_el = (read_sysreg(CurrentEL) >> 2) & 0x3;
    test1();
    printk("after : Current exception level is EL%lu\n", current_el);

    vm_main(gpa_addr);
    

}